home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 2000 February
/
Macworld (2000-02).dmg
/
Shareware World
/
Comms & Internet
/
Flex-Able 1.0
/
FADocs
/
session.able
< prev
next >
Wrap
Text File
|
1999-12-07
|
2KB
|
65 lines
<html>
<head>
<link rel=stylesheet type="text/css" HREF="fa.css">
<title>Flex-Able: Sessions</title>
</head>
<body>
<DIV CLASS="topic">Sessions</DIV>
<p><br>
<p><br>
To activate a session, simply use the
get_session command and store the result:<br> <ul>
<:set someVar <:get_session>> </ul> If the browser already has a
cookie that matches an active session, then the data for that session is
made available through the given variable (in this case someVar) as an
associative array. If the browser doesn't have a cookie, or that cookie
doesn't match an active session, a new session array is created and the
browser is sent a "Set-Cookie" field as part of the response.<br>
There are some special members of the session array:<p>
<ul>
<li><b>$timeout</b><br><ul>how long the session will live in spite of
inactivity on the browser's part. Measured in minutes.</ul>
<li><b>$id</b><br><ul>the session ID, which is also the cookie value sent to
the browser for identification</ul> <li><b>$lastuse</b><br><ul>a big number
that is used internally to keep track of how long it has been since the
session was used</ul> </ul> If you wish to remove session data from memory,
use:<br> <ul> <:end_session> </ul> Keep in mind that if you have
already used the <:get_session> command, the variable you assigned the
session data to is still good. However, if you overwrite that variable with
something else, then the session data will be removed from memory.
Otherwise, the session data won't be deleted until the connection ends.
</ul>
<!-- First, read the form data --> <:set form <:read_form>>
<!-- Either set the session and get new data, or end it --> <:ifempty
form["Logout"]> <:set sdata <:get_session>> <:require form["new name"] form["new
value"]> <:set sdata[form["new name"]] form["new value"]> <:/require>
<:else> <!-- delete the session --> <:end_session> <:/ifempty>
<h2>Current Session Variables</h2>
<table> <:foreach name value sdata> <tr> <th align=right><:echo name></th>
<td aligh=left><:echo value></td> </tr><:/foreach> </table><P>
<h2>Add Another Variable</h2> <form action="session.able" method=POST> Name:
<input type=text name="new name"><br> Value: <input type=text name="new
value"><br> <input type=submit value="add"> <input type=submit name="Logout"
value="End Session"> </form><P>
<hr>
<A HREF="default.html" CLASS="back">back to Contents</A>/<A HREF="quickstart.html" CLASS="back">back to Quick Start</A>
</body>
</html>